package com.dmapp.utils;


public class AppUtils {

	
	public static String HOST = "http://115.29.191.0/wtt/"; //"http://211.152.36.142/wtt/"; //"http://211.152.36.142/decp"; // 
	

	
	
/*	
	
	public static BitmapDownloader mDownloader = new BitmapDownloader(10);
	
	
	
	
	
	
	public static boolean  checkInfo(Activity activity, String str){
		
		boolean b = true;

		
		while(true){
			if(str.length() < 4 || str.length() > 16){
				b =false;
				break;
			}
			
			if(Utils1.isNumeric(str.substring(0,1))){
				b=false;
				break;
			}
			
			
			break;
				
		}
				
	
		if(b == false)
			Utils1.showToastShort(activity, "请输入有效账户名~");   //输入账户名不合法
		
		return b;
	}
	
	
	
	public static void changeSize(Activity activity, WebView webview){
		

		DisplayMetrics metrics = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
	     int mDensity = metrics.densityDpi;
	     System.out.println("DPI: "+mDensity);
	    if (mDensity >= 120 && mDensity < 240) {  // 120dpi 160dpi 240dpi 320dpi   
	    	webview.setInitialScale(35);
       }else if (mDensity >= 240 && mDensity < 320) {
    	   
    	   webview.setInitialScale(70);
       }
       else if(mDensity >= 320){
    	   webview.setInitialScale(100);
    //	   webview.getSettings() .setUseWideViewPort(true);
    //	   webview.getSettings().setLoadWithOverviewMode(true);
       }
	     
	     
	}

	
	
	
	
	
	
	// 注意要用Release的签名
	
public static void shareWay(final Activity activity, String text, String url_image) {
		
		{
			final OnekeyShare oks = new OnekeyShare();
			oks.setNotification(R.drawable.logo, activity.getString(R.string.app_name));
				oks.setTitle( activity.getString(R.string.app_name) );
				oks.setText( text );
			//	oks.setImagePath(MainActivity.TEST_IMAGE);
				oks.setImageUrl( url_image );
//				oks.setUrl("http://www.sharesdk.cn");
		
				oks.setSilent(false);
			
				// 去除注释，可令编辑页面显示为Dialog模式
//				oks.setDialogMode();

				// 去除注释，在自动授权时可以禁用SSO方式
//				oks.disableSSOWhenAuthorize();

				
				final Handler handler =new Handler(){
					@Override
					public void handleMessage(Message msg) {
						// TODO Auto-generated method stub
						super.handleMessage(msg);
						
						if(msg.what == 0)
							Utils1.showToastShort(activity, "取消分享~");
						else if(msg.what == 1)
							Utils1.showToastShort(activity, "分享成功~");
						else
							Utils1.showToastShort(activity, "分享失败~");
						
					}
				};
				
				// 去除注释，则快捷分享的操作结果将通过OneKeyShareCallback回调
				oks.setCallback(new PlatformActionListener(){

					@Override
					public void onCancel(Platform arg0, int arg1) {
						// TODO Auto-generated method stub
						handler.sendEmptyMessage(0);
					}

					@Override
					public void onComplete(Platform arg0, int arg1,
							HashMap<String, Object> arg2) {
						// TODO Auto-generated method stub
						handler.sendEmptyMessage(1);
					}

					@Override
					public void onError(Platform arg0, int arg1, Throwable arg2) {
						// TODO Auto-generated method stub
						handler.sendEmptyMessage(2);
					}
					
				});
				oks.setShareContentCustomizeCallback(new ShareContentCustomizeDemo());
				oks.show(activity); // menu.getContext()
			
			
		}
		// TODO Auto-generated method stub

	}


private static void showShare(boolean silent, String platform, Activity activity,
		String url, String path, String text) {
	final OnekeyShare oks = new OnekeyShare();
	oks.setNotification(R.drawable.logo, activity.getString(R.string.app_name));
//	oks.setAddress("12345678901");
//	oks.setTitle( "setTitle" );
//	oks.setTitleUrl("http://sharesdk.cn");
	oks.setText( text );
//	oks.setImagePath(MainActivity.TEST_IMAGE);
	oks.setImageUrl("http://img.appgo.cn/imgs/sharesdk/content/2013/07/25/1374723172663.jpg");
//	oks.setUrl("http://www.sharesdk.cn");
//	oks.setFilePath(MainActivity.TEST_IMAGE);
//	oks.setComment(menu.getContext().getString(R.string.share));
//	oks.setSite(menu.getContext().getString(R.string.app_name));
//	oks.setSiteUrl("http://sharesdk.cn");
//	oks.setVenueName("ShareSDK");
//	oks.setVenueDescription("This is a beautiful place!");
	
	// 加上gps信息呢.
//	oks.setLatitude(23.056081f);
//	oks.setLongitude(113.385708f);
	oks.setSilent(silent);
	if (platform != null) {
		oks.setPlatform(platform);
	}

	// 去除注释，可令编辑页面显示为Dialog模式
//	oks.setDialogMode();

	// 去除注释，在自动授权时可以禁用SSO方式
//	oks.disableSSOWhenAuthorize();

	// 去除注释，则快捷分享的操作结果将通过OneKeyShareCallback回调
//	oks.setCallback(new OneKeyShareCallback());
	oks.setShareContentCustomizeCallback(new ShareContentCustomizeDemo());

	// 去除注释，演示在九宫格设置自定义的图标
//	Bitmap logo = BitmapFactory.decodeResource(menu.getResources(), R.drawable.ic_launcher);
//	String label = menu.getResources().getString(R.string.app_name);
//	OnClickListener listener = new OnClickListener() {
//		public void onClick(View v) {
//			String text = "Customer Logo -- ShareSDK " + ShareSDK.getSDKVersionName();
//			Toast.makeText(menu.getContext(), text, Toast.LENGTH_SHORT).show();
//			oks.finish();
//		}
//	};
//	oks.setCustomerLogo(logo, label, listener);

	oks.show(activity); // menu.getContext()
}

*/


	
}


